
#百度搜索某个人,爬取百度搜索的网页

# import requests
# wd = input("请输入一个人名：")
# url = f"https://www.baidu.com/s?ie=UTF-8&wd={wd}"
# fake_headers ={
# "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36 Edg/91.0.864.41"
# }
#
# print(requests.get(url,headers =fake_headers).text)

import requests

# 爬取百度翻译的内容
url = "https://fanyi.baidu.com/sug"

word = input("请输入你想翻译的单词")

dt = {
    "kw":word
}

fake_headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36 Edg/91.0.864.41"
}
#发送post请求，发送的数据必须存放在字典中，然后通过data参数进行传递

resp=requests.post(url,data = dt)

print(resp.json())#将服务器返回的内容直接处理成json

#爬取酷狗音乐的榜单top500


